/**
 * Copyright (c) Jan 21, 2013 1:42:52 PM WKM and/or its affiliates. 
 * Use is subject to license terms.
 * All rights reserved.
 */
package org.extblog.wkm.web.jobs;

import java.util.Calendar;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * @author WKM 心跳包
 * Heartbeat.java history
 * 1.WKM - Jan 21, 2013 - Create File
 */
public class Heartbeat extends AbstractJob {

	/** 超时时间 **/
	private int timeout = 5;

	public void setTimeout(int timeout) {
		this.timeout = timeout;
	}

	/* (non-Javadoc)
	 * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
	 */
	@Override
	protected void executeInternal(JobExecutionContext context)
			throws JobExecutionException {
		// TODO Auto-generated method stub
		log.info("超时时间:" + timeout +  ";当前时间是:" + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(Calendar.getInstance()));
		long max = Runtime.getRuntime().maxMemory();
		long free = Runtime.getRuntime().freeMemory();
		long total = Runtime.getRuntime().totalMemory();
		log.info("内存总数:" + total/1024/1024 + "MB;最大内存:" + max/1024/1024 + "MB;空闲内存:" + free/1024 + "KB.");
	}

	

}
